home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.3 Development Libraries / SGI IRIX 6.3 Development Libraries.iso / dist6.3 / ViewKit_dev.idb / usr / share / src / ViewKit / Applications / PhoneBook / Data.h.z / Data.h
Encoding:
C/C++ Source or Header  |  1996-09-20  |  2.2 KB  |  65 lines

  1. ////////////////////////////////////////////////////////////////////////////////
  2. ///////   Copyright 1992, Silicon Graphics, Inc.  All Rights Reserved.   ///////
  3. //                                                                            //
  4. // This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;     //
  5. // the contents of this file may not be disclosed to third parties, copied    //
  6. // or duplicated in any form, in whole or in part, without the prior written  //
  7. // permission of Silicon Graphics, Inc.                                       //
  8. //                                                                            //
  9. // RESTRICTED RIGHTS LEGEND:                                                  //
  10. // Use,duplication or disclosure by the Government is subject to restrictions //
  11. // as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data     //
  12. // and Computer Software clause at DFARS 252.227-7013, and/or in similar or   //
  13. // successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -    //
  14. // rights reserved under the Copyright Laws of the United States.             //
  15. //                                                                            //
  16. ////////////////////////////////////////////////////////////////////////////////
  17. #ifndef DATA_H
  18. #define DATA_H
  19.  
  20. #include <X11/Intrinsic.h>
  21.  
  22. class Data;
  23.  
  24. extern Data *theData;
  25.  
  26. typedef struct {
  27.     char *name;
  28.     char *phone;
  29.     char *addr;
  30.     char *comment;
  31. } DataElement;
  32.  
  33. typedef struct _DataList {
  34.     DataElement *element;
  35.     struct _DataList *next;
  36. } DataList;
  37.  
  38. class Data {
  39.   public:
  40.     Data();
  41.     ~Data();
  42.  
  43.     Boolean openFile(char *filename);
  44.     Boolean writeFile(char *filename);
  45.     Boolean isDirty() { return dirty; }
  46.     
  47.     DataList *allData() { return head->next; }
  48.     DataList *findLastName(char lastPrefix);
  49.     void addEntry(char *name, char *phone, char *addr, char *comment);
  50.     void removeEntry(DataElement *element);
  51.     void changeEntry(DataElement *element,
  52.              char *name, char *phone, char *addr, char *comment);
  53.  
  54.  protected:
  55.     char upper(char ch);
  56.     void deleteData();
  57.     void insertElement(DataElement *element);
  58.     void resort(DataElement *element);
  59.  
  60.     DataList *head;
  61.     Boolean dirty;
  62. };
  63.  
  64. #endif
  65.